/**
 * @Author: 健聪
 * @Description: 数据类型 map
 * @Date: 2024/01/10
 */
void main() {
  var map1 = {'first': 'Dart', 1: true};
  print(map1);

  print(map1['first']);
  print(map1[1]);
  map1[1] = false;
  print(map1[1]);

  // var map2 = const {1: 'Dart', 2:'Java'};
  // map2[1] = "Python";  // 不能给不可变的map进行修改值
  // var map3 = new Map();

  var map4 = {'first':'Dart', 'second':'Java', 'third':'Python'};
  print(map4.length);
  // map4.isEmpty();
  print(map4.keys);
  print(map4.values);
  print(map4.containsKey('first'));
  print(map4.containsValue('C'));
  map4.remove('third');
  print(map4);
  // map4.forEach(f);
  map4.forEach((key, value) {
    print("key=$key, value=$value");
  });

  var list = ['1', '2', '3'];
  print(list.asMap());
}

// void f(key, value) {
//   print('key=$key, value=$value');
// }